//
//  BBYLookForPhotoVC.m
//  BearSiX
//
//  Created by Tom on 16/3/28.
//  Copyright © 2016年 Tom. All rights reserved.
//

#import "BBYLookForPhotoVC.h"
#import "BBYAllLookViewController.h"
@interface BBYLookForPhotoVC ()<UICollectionViewDataSource,UICollectionViewDelegate>
@property(nonatomic,strong)UICollectionView *collectionView;
@end

@implementation BBYLookForPhotoVC
-(UICollectionView *)collectionView{

    if (!_collectionView) {
        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
        [flowLayout setMinimumInteritemSpacing:WINSIZEWIDTH/35];
        [flowLayout setMinimumLineSpacing:WINSIZEWIDTH/30];
        [flowLayout setSectionInset:UIEdgeInsetsMake(WINSIZEWIDTH/30, WINSIZEWIDTH/30, WINSIZEWIDTH/20, WINSIZEWIDTH/30)];
        [flowLayout setItemSize:CGSizeMake((WINSIZEWIDTH-WINSIZEWIDTH/10)/2, WINSIZEWIDTH/1.36)];
        _collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, WINSIZEWIDTH, self.view.height) collectionViewLayout:flowLayout];
        _collectionView.delegate = self;
        _collectionView.dataSource = self;
        _collectionView.backgroundColor = [UIColor whiteColor];
    }
    return _collectionView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"查看图片";
    [self.view addSubview:self.collectionView];
    [self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{

    return 10;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.backgroundColor = [UIColor brownColor];
    UIImageView *imageView =[[ UIImageView alloc]initWithFrame:CGRectMake(0, 0, cell.width, cell.height)];
    imageView.image = [UIImage imageNamed:@"testYYY.jpg"];
    [cell.contentView addSubview:imageView];
   // cell.backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"first_back_y"]];
    return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{

    BBYAllLookViewController *lookImages = [[BBYAllLookViewController alloc]init];
    [self.navigationController pushViewController:lookImages animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
